import random
import sys

print("+-----------------------------------+")
print("|                                   |")
print("|         花有重开日，人无再少年        |")
print("|           欢迎来到人生模拟器         |")
print("|                                   |")
print("+-----------------------------------+")

while True:
    print('请设置初始属性（可用点数总数为 20）')
    face = int(input('请输入颜值（1~10）:'))
    strong = int(input('请输入体质（1~10）:'))
    iq = int(input('请输入智商（1~10）:'))
    home = int(input('请输入家境（1~10）:'))

    if face < 1 or face > 10:
        print('颜值设置有误！')
        continue
    if strong < 1 or strong > 10:
        print('体质设置有误！')
        continue
    if iq < 1 or iq > 10:
        print('智商设置有误！')
        continue
    if home < 1 or home > 10:
        print('家境设置有误！')
        continue
    if face + strong + iq + home > 20:
        print('总值设置有误!')
        continue
    print('初始设置完成')
    print(f'颜值:{face}  体质:{strong}  智商:{iq}  家境:{home}')
    break

sex = random.randint(0, 1)
if sex == 0:
    print("你是一个女孩")
else:
    print('你是一个男孩')
point = random.randint(1, 3)
if home == 10:
    print("你出生在帝都， 你的父母是政要高管")
    face += 1
    iq += 1
    home += 1
elif 7 <= home <= 9:
    if point == 1:
        print('你出生在大城市，你的父母是大学教授')
        iq += 2
    elif point == 2:
        print('你出生在大城市，你的父母是公务员')
        home += 2
    else:
        print('你出生在大城市，你的父母是公司高管')
        home += 1
        face += 1
elif 4 <= home <= 6:
    if point == 1:
        print('你出生在小城市，你的父母是老师')
        iq += 1
    elif point == 2:
        print('你出生在小城市，你的父母是医生')
        strong += 1
    else:
        print('你出生在小城市，你的父母是小老板')
        home += 1
else:
    if point == 1:
        print('你出生在农村，你的父母是农民')
        strong += 1
        face -= 2
    elif point == 2:
        print('你出生在穷乡僻壤，你的父母是无业游民')
        home -= 1
    else:
        print('你出生在小镇，你的父母感情不和')
        strong -= 1

print(f'颜值:{face}  体质:{strong}  智商:{iq}  家境:{home}')


for age in range(1, 11):
    info = ""
    info += f'你今年{age}岁，'
    if home < 4 and sex == 0:
        event = random.randint(1, 4)
        if event == 1:
            info += "由于家境贫寒且重男轻女，你的父母对你态度冷淡，颜值-1。\n"
            face -= 1
        elif event == 2:
            info += "你因重男轻女的观念被忽视，体质-1。\n"
            strong -= 1
        elif event == 3:
            info += "你因重男轻女的观念被遗弃了，游戏介绍。\n"
            sys.exit(0)
        else:
            info += "你因重男轻女的观念被送去亲戚家寄养，家境-1。\n"
            home -= 1
    if age == 1:
        event = random.randint(1, 6)
        if event == 1:
            if iq >= 5:
                info += "你天资聪颖，学会了走路和简单的词汇，智商+2。\n"
                iq += 2
            else:
                info += "你学会了走路，智商+1。\n"
                iq += 1
        elif event == 2:
            if home >= 7:
                info += "你在父母的悉心教导下咿呀学语，智商+2。\n"
                iq += 2
            else:
                info += "你咿呀学语，智商+1。\n"
                iq += 1
        elif event == 3:
            if face >= 7:
                info += "你长得非常可爱，邻居们都夸你是小天使，颜值+2。\n"
                face += 2
            else:
                info += "你长得很可爱，颜值+1。\n"
                face += 1
        elif event == 4:
            if home >= 8:
                info += "你的父母给你买了许多高端玩具，家境-2，但你很开心。\n"
                home -= 2
            else:
                info += "你的父母给你买了许多玩具，家境-1。\n"
                home -= 1
        elif event == 5:
            if strong <= 3:
                info += "你生了一场大病，体质-2，家境-1。\n"
                strong -= 2
                home -= 1
            else:
                info += "你生了一场病，体质-1。\n"
                strong -= 1
        else:
            if home <= 3:
                info += "你因家境贫寒未能及时治疗罕见疾病，不幸夭折，人生结束。\n"
            else:
                info += "你因罕见疾病不幸夭折，人生结束。\n"
            print(info)
            sys.exit(0)
    elif age == 2:
        event = random.randint(1, 6)
        if event == 1:
            if iq >= 6:
                info += "你开始上早教班，表现出极高的学习能力，智商+2。\n"
                iq += 2
            else:
                info += "你开始上早教班，智商+1。\n"
                iq += 1
        elif event == 2:
            if strong >= 5:
                info += "你喜欢跑来跑去，体质+2，邻居们都夸你活泼可爱。\n"
                strong += 2
            else:
                info += "你喜欢跑来跑去，体质+1。\n"
                strong += 1
        elif event == 3:
            if face >= 7:
                info += "你被邻居夸奖长得漂亮，甚至有人说你像个小明星，颜值+2。\n"
                face += 2
            else:
                info += "你被邻居夸奖长得漂亮，颜值+1。\n"
                face += 1
        elif event == 4:
            if home >= 7:
                info += "你的父母因为照顾你，在工作上分心了，但他们依然努力维持生活，家境-1。\n"
                home -= 1
            else:
                info += "你的父母因为照顾你，在工作上分心了，家境-2。\n"
                home -= 2
        elif event == 5:
            if strong <= 3:
                info += "你摔了一跤，伤得不轻，体质-2。\n"
                strong -= 2
            else:
                info += "你摔了一跤，体质-1。\n"
                strong -= 1
        else:
            if home <= 3:
                info += "你因意外事故不幸夭折，家境贫寒未能及时救治，人生结束。\n"
            else:
                info += "你因意外事故不幸夭折，人生结束。\n"
            print(info)
            sys.exit(0)
    elif age == 3:
        event = random.randint(1, 6)
        if event == 1:
            if strong >= 5:
                info += "你学会了骑三轮车，表现得非常灵活，体质+2。\n"
                strong += 2
            else:
                info += "你学会了骑三轮车，体质+1。\n"
                strong += 1
        elif event == 2:
            if iq >= 6:
                info += "你开始认字，展现出过人的学习能力，智商+2。\n"
                iq += 2
            else:
                info += "你开始认字，智商+1。\n"
                iq += 1
        elif event == 3:
            if face >= 7:
                info += "你被选为幼儿园的模范宝宝，大家都夸你漂亮可爱，颜值+2。\n"
                face += 2
            else:
                info += "你被选为幼儿园的模范宝宝，颜值+1。\n"
                face += 1
        elif event == 4:
            if home >= 7:
                info += "你的父母给你买了很多新衣服，你穿得像个小公主/小王子，家境-1，颜值+1。\n"
                home -= 1
                face += 1
            else:
                info += "你的父母给你买了很多新衣服，家境-1。\n"
                home -= 1
        elif event == 5:
            if strong <= 3:
                info += "你感冒了，病得很严重，体质-2。\n"
                strong -= 2
            else:
                info += "你感冒了，体质-1。\n"
                strong -= 1
        else:
            if home <= 3:
                info += "你因严重疾病未能及时治疗，不幸夭折，人生结束。\n"
            else:
                info += "你因严重疾病不幸夭折，人生结束。\n"
            print(info)
            sys.exit(0)
    elif age == 4:
        event = random.randint(1, 5)
        if event == 1:
            if iq >= 6:
                info += "你展现出绘画天赋，画作被老师展示，智商+2，颜值+1。\n"
                iq += 2
                face += 1
            else:
                info += "你学会了画画，智商+1。\n"
                iq += 1
        elif event == 2:
            if strong >= 5:
                info += "你在滑梯上玩得很开心，还教会了其他小朋友，体质+2，家境+1。\n"
                strong += 2
                home += 1
            else:
                info += "你喜欢玩滑梯，体质+1。\n"
                strong += 1
        elif event == 3:
            if face >= 7:
                info += "你因长相可爱被幼儿园老师选为班级代表，颜值+2，智商+1。\n"
                face += 2
                iq += 1
            else:
                info += "你被幼儿园老师夸奖，颜值+1。\n"
                face += 1
        elif event == 4:
            if home >= 7:
                info += "你的父母带你去高端游乐园玩了一整天，家境-2，但你非常开心，体质+1。\n"
                home -= 2
                strong += 1
            else:
                info += "你的父母带你去游乐园，家境-1。\n"
                home -= 1
        else:
            if home <= 3:
                info += "你不小心摔坏了玩具，父母责怪你，家境-1，智商-1。\n"
                home -= 1
                iq -= 1
            else:
                info += "你不小心摔坏了玩具，家境-1。\n"
                home -= 1
                # 每个事件请你结合home,face,iq,strong的一种或多种做出具体适合属性改变与故事经历
    if age == 5:
        if face >= 7:
            info += "你因为长得好看被选为幼儿园的形象代言人，颜值+1。\n"
            face += 1
        elif strong >= 7:
            info += "你因为体质好成为幼儿园运动会的冠军，体质+1。\n"
            strong += 1
        elif iq >= 7:
            info += "你因为聪明被老师表扬为小小天才，智商+1。\n"
            iq += 1
        elif home >= 7:
            info += "你因为家境优越被送去高端幼儿园，家境+1。\n"
            home += 1
        else:
            negative_event = random.randint(1, 3)
            if negative_event == 1:
                info += "你在幼儿园摔了一跤，体质-1。\n"
                strong -= 1
            elif negative_event == 2:
                info += "你因为调皮被老师批评，智商-1。\n"
                iq -= 1
            else:
                info += "你因为和小朋友争吵被孤立了一段时间，颜值-1。\n"
                face -= 1
    elif age == 8:
        event = random.randint(1, 6)
        if event == 1:
            if iq <= 4:
                info += "由于学习能力较差，你在学校被老师批评，智商-1。\n"
                iq -= 1
            elif iq >= 7:
                info += "你在学校的数学竞赛中获得了一等奖，智商+1。\n"
                iq += 1
        elif event == 2:
            if strong <= 3:
                info += "由于体质较差，你在运动会上摔倒受伤，体质-1。\n"
                strong -= 1
            elif strong >= 7:
                info += "你在学校的运动会上获得了跑步冠军，体质+1。\n"
                strong += 1
        elif event == 3:
            if face <= 3:
                info += "由于长相普通，你在文艺表演中被替换，颜值-1。\n"
                face -= 1
            elif face >= 7:
                info += "你被选为学校的文艺表演主角，颜值+1。\n"
                face += 1
        elif event == 4:
            if home <= 3:
                info += "由于家境贫寒，你无法参加兴趣班，智商-1。\n"
                iq -= 1
            elif home >= 7:
                info += "你的父母为你报了许多兴趣班，家境-1。\n"
                home -= 1
        elif event == 5:
            if iq <= 3:
                info += "由于学习能力不足，你的成绩进一步下降，智商-2。\n"
                iq -= 1
            else:
                info += "你因为贪玩成绩下降，智商-1。\n"
                iq -= 1
        else:
            if strong <= 3:
                info += "由于体质较差，你在冲突中受伤，体质-1。\n"
                strong -= 1
            else:
                info += "你在学校和同学发生冲突，颜值-1，体质-1。\n"
                face -= 1
                strong -= 1
            info += "你在学校和同学发生冲突，颜值-1，体质-1。\n"
            face -= 1
            strong -= 1
    elif age == 10:
        event = random.randint(1, 5)
        if event == 1:
            info += "你开始上小学，认识了许多新朋友，颜值+1。\n"
            face += 1
        elif event == 2:
            info += "你参加了学校的足球队，体质+1。\n"
            strong += 1
        elif event == 3:
            info += "你在班级里成绩优异，智商+1。\n"
            iq += 1
        elif event == 4:
            info += "你的家境改善，父母给你买了新书包，家境+1。\n"
            home += 1
        else:
            info += "你因为调皮被老师批评，智商-1。\n"
            iq -= 1
    print(info)

for age in range(11, 26):
    info = f'你今年{age}岁，'
    if age == 13:
        if strong <= 4:
            info += "你因为体质较差，体育课上晕倒了，体质-1。\n"
            strong -= 1
        elif strong >= 8:
            info += "你在学校运动会上表现出色，成为校队成员，体质+1。\n"
            strong += 1
    elif age == 15:
        if iq <= 4:
            info += "你因为学习成绩差，被父母责骂，智商-1。\n"
            iq -= 1
        elif iq >= 8:
            info += "你在学校的科学竞赛中获得一等奖，智商+1。\n"
            iq += 1
    elif age == 16:
        if face <= 4:
            info += "你因为长相普通，在班级活动中被忽视，颜值-1。\n"
            face -= 1
        elif face >= 8:
            if sex == 0:
                info += "你因为长得漂亮，被选为校花，颜值+1。\n"
            else:
                info += "你因为长得帅气，被选为校草，颜值+1。\n"
            face += 1
    elif age == 18:
        if iq >= 7:
            info += "你在高考中取得优异成绩，考上了名牌大学，智商+1。\n"
            iq += 1
        else:
            info += "你在高考中发挥失常，只能上普通大学，智商-1。\n"
            iq -= 1
    elif age == 20:
        if home >= 7:
            info += "你因为家境优越，出国留学，家境-1，智商+1。\n"
            home -= 1
            iq += 1
        else:
            info += "你因为家境一般，选择在本地大学深造。\n"
    elif age == 22:
        if iq >= 8:
            info += "你大学毕业后，进入了一家知名企业工作，智商+1。\n"
            iq += 1
        else:
            info += "你大学毕业后，找了一份普通工作。\n"
    elif age == 24:
        if face >= 7 and sex == 0:
            info += "你因为长得漂亮，遇到了一个优秀的男朋友，颜值+1。\n"
            face += 1
        elif face >= 7 and sex == 1:
            info += "你因为长得帅气，遇到了一个优秀的女朋友，颜值+1。\n"
            face += 1
        else:
            info += "你因为性格内向，暂时没有遇到合适的恋人。\n"
    print(info)

for age in range(26, 51):
    info += f'你今年{age}岁，'
    if age == 30:
        info += "你成家立业。\n"
    elif age == 40:
        info += "你事业有成。\n"

for age in range(51, 101):
    info += f'你今年{age}岁，'
    if age == 60:
        info += "你退休了。\n"
    elif age == 80:
        info += "你安享晚年。\n"
    elif age == 100:
        info += "你走完了人生的旅程。\n"

print(f'颜值:{face}  体质:{strong}  智商:{iq}  家境:{home}')
